﻿using System;
namespace LeRenard.ScriptWars.Model.Scripting.OperationParameterTypeValueConverters
{
    /// <summary>
    /// Defines a converter for a <see cref="IOperationParameter"/>'s value type.
    /// </summary>
    public interface IOperationParameterTypeValueConverter<T>
    {
        /// <summary>
        /// Gets the parameter type it converts to/from.
        /// </summary>
        OperationParameterType ParameterType { get; }

        /// <summary>
        /// Gets the .Net <see cref="Type"/> it converts to/from.
        /// </summary>
        Type Type { get; }

        /// <summary>
        /// Converts the raw script value to a .Net type value.
        /// </summary>
        /// <param name="parameterValue">The value to be converted.</param>        
        T ConvertFromScriptValue(string parameterValue);

        /// <summary>
        /// Converts a .Net type value to the raw script value.
        /// </summary>
        /// <param name="parameterValue">the value to be converted.</param>        
        string ConvertToScriptValue(T parameterValue);
    }
}
